import http from '@/utils/service';

const API = {
  getSeatList: 'seat/getSeatList',
  createSeat: 'seat/createSeat',
  getSeat: 'seat/getSeat',
  updateStatus: 'seat/updateStatus',
  getSeatTotal: 'seat/getSeatTotal',
  deleteSeat: 'seat/deleteSeat',
};

export interface Seat {
  id: number;
  seatName: string;
  seatSize: string;
  seatStatus: number;
  time: number[];
}

export interface GetSeatTime {
  id: number;
  time: string;
}

export interface GetSeatById {
  time: string;
  restaurantId: number;
}
export interface DataType {
  id?: number;
  restaurantId: number;
  seatName: string;
  seatSize: number;
  seatStatus?: number;
}

export const createSeatAPI = (data: DataType) =>
  http.post(API.createSeat, { data });

export const getSeatByIdAPI = (data: GetSeatById) =>
  http.post(API.getSeatList, { data });

export const getSeatListAPI = (restaurantId: number) =>
  http.get(API.getSeat + `?restaurantId=${restaurantId}`);
export const updateStatusAPI = (seatId: number) =>
  http.get(API.updateStatus + `?seatId=${seatId}`);
export const getSeatTotalAPI = (restaurantId: number) =>
  http.get(API.getSeatTotal + `?restaurantId=${restaurantId}`);
export const deleteSeatAPI = (seatId: number) =>
  http.delete(API.deleteSeat + `?seatId=${seatId}`);
